<?php
require_once('../../controller/auth.php');
//Start session
	session_start();
	
	//Include database connection details
	require_once('../inc/config.inc');
	
	
	
	//Connect to mysql server
	$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
	if(!$link) {
		die('Failed to connect to server: ' . mysql_error());
	}
	
	//Select database
	$db = mysql_select_db(DB_DATABASE);
	if(!$db) {
		die("Unable to select database");
	}
	
	$proj_name=$_POST['pro_name'];
	$proj_no=$_POST['proNo'];
	$proj_amount=$_POST['pAm'];
	$f_loc=$_POST['fLoc'];
	$desc=$_POST['desc'];
	$dt=$_POST['dt'];
	$estdt=$_POST['estdt'];
	$sub_name=$_POST['sub_name'];
mysql_query ('SET NAMES utf8');
mysql_query('SET CHARACTER_SET utf8');
$insert=mysql_query("INSERT INTO main(serial, request_no,proj_name,est_day_ted, amount, description, file_location, prepared_date,status,submitted_by) VALUES(null,'$proj_no','$proj_name','$estdt','$proj_amount','$desc','$f_loc','$dt',0,'$sub_name') ");
//Status=0 means : initiated, 1 means: Approved by MoE, 2 means: Budged Allocated, 3 mean: Allotment Received, 4 means: Done
if($insert){
	
	
	?>
	<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	  <div class="modal-header">
	    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
	    <h3 id="myModalLabel">Thank you,</h3>
	  </div>
	  <div class="modal-body">
	    <p class="text-success lead">Your Project has been Created Successfully!</p>
	  </div>
	  <div class="modal-footer">
	    <button class="btn btn-large btn-success btn-block" data-dismiss="modal" aria-hidden="true">OK</button>
	    
	  </div>
	</div>
	
	<?php
	}
	else {
	?>
	<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	  <div class="modal-header">
	    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
	    <h3 id="myModalLabel">OOops!</h3>
	  </div>
	  <div class="modal-body">
	    <p class="text-error lead">Your Project has not been Created Successfully!</p>
	  </div>
	  <div class="modal-footer">
	    <button class="btn btn-large btn-danger btn-block" data-dismiss="modal" aria-hidden="true">Shut Up!</button>
	    
	  </div>
	</div>
	<?php
		
		}
		?>
	
